package com.zh.repo.service.impl.workflow;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.sun.media.jfxmedia.logging.Logger;
import com.zh.repo.dao.workflow.ServiceInfoDao;
import com.zh.repo.entity.workflow.FM66Dt1;
import com.zh.repo.service.HrmResourceService;
import com.zh.repo.service.workflow.ServiceInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @description:
 * @author:
 * @time: 2025-05-20 16:16
 * @version: 1.0
 */
@Service
@Slf4j
@DS("oasource")
public class ServiceInfoServiceImpl implements ServiceInfoService {
    @Resource
    private ServiceInfoDao serviceInfoDao;
    @Resource
    private HrmResourceService hrmResourceService;


    @Override
    public int saveF66Dt1(FM66Dt1 fm66Dt1) {
        Integer mainId=getMainidByRequestid(fm66Dt1.getRequestid());
        Integer fwbry=hrmResourceService.getIDByName(fm66Dt1.getServiceName());
        fm66Dt1.setFwbry(fwbry);
        fm66Dt1.setMainid(mainId);
        log.info("待插入到现场调试流程的数据是：{}",fm66Dt1);
        serviceInfoDao.saveF66Dt1(fm66Dt1);
        return 0;
    }

    @Override
    public Integer getMainidByRequestid(Integer requestid) {
        return serviceInfoDao.getMainidByRequestid(requestid);
    }
}
